package xin.petstore.framework.web.img.dbmanager;

import com.mongodb.gridfs.GridFSDBFile;

import org.bson.types.ObjectId;
import java.io.File;
import java.io.InputStream;
import java.util.List;

/**
 * =============================
 * Author:
 * Function:
 * Version: 1.0
 * Date: 2016/7/4 0004
 * =============================
 */
public  interface AbstractMgRepository<T> {


    public <T> T findOne(String key, String val) ;

    public <T> List<T> findAll() ;

    public <T> List<T> findByRegex(String key, String val);

    public void removeOne(String key, String id);

    public Object saveGridFSFile(File file, String fileName) ;
    
    public Object saveGridFStream(InputStream file, String fileName) ;

    public void remGridFS(ObjectId _id) ;

    public void remGridFS(String fileName) ;

    public GridFSDBFile  getGridFS(ObjectId _id) ;

    public List<GridFSDBFile>  getGridFSList(List<String> dbObject) ;

    public GridFSDBFile getGridFS(String fileName) ;

    public <T> List distinct(String fielname);

    public Long count(String key, String val) ;

    public void insert(Object t) ;

    public List getRedisCacheList(String key);

    public List getRandomList(int n);

    public String getFileNameByOid(Object id);
    }